package com.gitee.zhuhjay.xunfei.sdk.model;

import cn.hutool.core.util.StrUtil;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * api授权信息
 *
 * @author ZhuHJay
 * @since 2023/11/2 8:54
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ApiAuth {
    private String appId;
    private String apiKey;
    private String apiSecret;

    /**
     * 检查授权信息是否完整
     */
    public void check() {
        if (StrUtil.isBlank(this.appId)) {
            throw new IllegalArgumentException("appId can not be blank");
        }
        if (StrUtil.isBlank(this.apiKey)) {
            throw new IllegalArgumentException("apiKey can not be blank");
        }
        if (StrUtil.isBlank(this.apiSecret)) {
            throw new IllegalArgumentException("apiSecret can not be blank");
        }
    }
}
